import { lazy } from 'react'

import { createBrowserRouter, Navigate } from 'react-router-dom'
import Home from '@/views/home'

const Login = lazy(() => import('@/views/login'))
// const Business = lazy(() => import('@/views/business'))
const Audio = lazy(() => import('../views/audio'))
const Aicreate = lazy(() => import('@/views/aicreate'))
// const Redirect = <Navigate to={isOperator ? 'agent' : 'tenant'} />
const Redirect = <Navigate to={'/audio'} />

const router = createBrowserRouter([
    {
        path: '/',
        element: <Home />,
        // errorElement: Redirect,
        children: [
            {
                index: true,
                element: Redirect
            },
            // {
            //     path: 'business',
            //     element: <Business />,
            // },
            {
                path: 'audio',
                element: <Audio />,
            },
            {
                path: 'aicreate',
                element: <Aicreate />,
            },
        ]
    }, {
        path: '/login',
        element: <Login />
    }
])

export default router
